package com.example.chat.repository;

import com.blinkfox.fenix.jpa.QueryFenix;
import com.example.chat.model.User;
import com.example.chat.model.ro.UserListRO;
import com.example.chat.model.vo.UserListVO;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;

import java.util.Optional;

/**
 * @author pq
 * @date 2022/8/14 0:59
 * @description
 * @modified
 **/
public interface UserRepository extends JpaRepository<User,String> {

    Optional<User> findByNicknameAndDataStatus(String nickname,Integer dateStatus);

    @QueryFenix(value = "UserRepository.findByPage", nativeQuery = true)
    Page<UserListVO> findByPage(@Param("ro")UserListRO ro, Pageable pageable);
}
